package com.dlut.java;

import java.util.HashMap;

/**
 * @Author: LiuHeng
 * @Description:
 * @Date: 2022-08-24 23:27
 */
public class subString {

    public boolean fun(int[] target, int[] arr){
        HashMap<Integer, Integer> map1 = new HashMap<>();
        HashMap<Integer, Integer> map2 = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            map1.put(arr[i], map1.getOrDefault(arr[i], 0) + 1);
            map2.put(target[i], map2.getOrDefault(target[i], 0) + 1);
        }
        for (int temp : map1.keySet()  ){
            if (map2.containsKey(temp) && map2.get(temp) == map1.get(temp)){
                continue;
            }else{
                return false;
            }
        }

        return true;
    }
}
